package siruna.WE.DeviceDependent;

import java.io.InputStream;
import java.util.HashMap;
import java.util.LinkedHashMap;

import siruna.WE.core.Widget;
import siruna.WE.core.model.VisualBlock;

import android.app.Application;

public class AndroidApplication extends Application {
	static HashMap<Integer, InputStream> icons;
	HashMap<Integer, Widget> widgets;
	private BroadcastReceiverImpl receiver;

	public BroadcastReceiverImpl getReceiver() {
		return receiver;
	}

	public void setReceiver(BroadcastReceiverImpl receiver) {
		this.receiver = receiver;
	}

	public AndroidApplication() {
		super();
		widgets = new HashMap<Integer, Widget>();
	}

	public HashMap<Integer, Widget> getWidgets() {
		return widgets;
	}

	public void setWidgets(HashMap<Integer, Widget> widgets) {
		this.widgets = widgets;
	}

	public HashMap<Integer, InputStream> getIcons() {
		return icons;
	}

	public void setIcons(HashMap<Integer, InputStream> icons) {
		this.icons = icons;
	}

	public void addWidget(int widgetId, Widget widget) {
		widgets.put(widgetId, widget);

	}

	public Widget getWidget(int widgetId) {
		System.out.println("getWidget, " + widgetId + ": "
				+ widgets.get(widgetId));
		System.out.println(widgets.size());
		System.out.println(widgets.containsKey(0));
		System.out.println(widgets.get(0));

		return widgets.get(widgetId);

	}

	public void updateVisualBlock(int widgetId, VisualBlock vb) {
		Widget widget = widgets.get(widgetId);
		widget.getVisblocks().put(vb.getId(), vb);
	}

}
